/*************************************************************************
    > File Name: main.c
    > Author: ma6174
    > Mail: ma6174@163.com 
    > Created Time: Sun 02 Nov 2025 06:59:33 PM CST
 ************************************************************************/

#include "my_stdio.h"
#include <stdio.h>
#include <string.h>

int main()
{
	mFILE* fp = mfopen("./log.txt","a");
	if(fp == NULL)
	{
		return 1;
	}

	int cnt = 10;
	while(cnt)
	{
		char buffer[64];
		snprintf(buffer,sizeof(buffer),"hello message,number is : %d\n",cnt);
		mfflush(fp);
		cnt--;
		mfwrite(buffer,strlen(buffer),fp);
		sleep(1);
	}

	mfclose(fp);
	return 0;
}
